package com.huawei.appgallery.assistantdock.base.service.base.dispatch;

import java.lang.reflect.InvocationTargetException;
import o.Logger;
import o.dof;

public enum GameServiceDispatchFactory {
    INSTANCE;
    
    private static final String TAG = "GameServiceDispatchFactory";

    public GameServiceDispatcher createDispatcher(String str) {
        if (dof.ॱ(str)) {
            return null;
        }
        GameServiceDispatcher gameServiceDispatcher;
        Class dispatcher = GameServiceDispatchRegister.getDispatcher(str);
        if (dispatcher != null) {
            try {
                gameServiceDispatcher = (GameServiceDispatcher) dispatcher.getConstructor(new Class[0]).newInstance(new Object[0]);
            } catch (InstantiationException e) {
                Logger.e(TAG, e.toString());
                gameServiceDispatcher = null;
            } catch (IllegalAccessException e2) {
                Logger.e(TAG, e2.toString());
                gameServiceDispatcher = null;
            } catch (InvocationTargetException e3) {
                Logger.e(TAG, e3.toString());
                gameServiceDispatcher = null;
            } catch (NoSuchMethodException e4) {
                Logger.e(TAG, e4.toString());
            }
            return gameServiceDispatcher;
        }
        gameServiceDispatcher = null;
        return gameServiceDispatcher;
    }

    public void registerDispatcher(String str, Class<? extends GameServiceDispatcher> cls) {
        GameServiceDispatchRegister.registerDispatcher(str, cls);
    }
}
